var menu = $('#header li.menu');
var submenu = $('#header li.menu ul.wrap');
submenu.css('display', 'none');
menu.mouseover(
	function() {
		$(this).find('.wrap').slideDown();
		$(this).siblings().find('.wrap').css('display', 'none');
	}
);
menu.mouseout(
	function() {
		submenu.css('display', 'none');
	}
);

var div = $('.our-member .data-item div');
var p = $('.our-member .data-item p');
var timer_member = setInterval(fun_member, 1000);

// 鼠标移入div：让对应的p出现, 取消计时器
div.mouseover(
	function() {
		$(this).siblings('p').css('display', 'block');
		clearInterval(timer_member);
	}
);
div.mouseout(
	function() {
		p.css('display', 'none');
		timer_member = setInterval(fun_member, 1000);
	}
);

function Student(id, name, hometown, title, img, motto) {
	this.id = id;
	this.name = name;
	this.hometown = hometown;
	this.title = title;
	this.img = img;
	this.motto = motto;
}
var s1 = new Student(1, '陈用群', '温州', '学生会', 'img/pic/1.jpg', '好好学习，天天向上');
var s2 = new Student(2, '郑良靖', '温州', '纪律委员', 'img/pic/2.jpg', '好好学习，天天向上');
var s3 = new Student(3, '杨翌', '丽水', '团支书', 'img/pic/3.jpg', '好好学习，天天向上');
var s4 = new Student(4, '陈一颖', '台州', '一姐', 'img/pic/4.jpg', '好好学习，天天向上');
var s5 = new Student(5, '陈用群', '温州', '学生会', 'img/pic/5.jpg', '好好学习，天天向上');
var s6 = new Student(6, '陈用群', '温州', '学生会', 'img/pic/6.jpg', '好好学习，天天向上');
var s7 = new Student(7, '陈用群', '温州', '学生会', 'img/pic/7.jpg', '好好学习，天天向上');
var s8 = new Student(8, '陈用群', '温州', '学生会', 'img/pic/8.jpg', '好好学习，天天向上');
var s9 = new Student(9, '陈用群', '温州', '学生会', 'img/pic/9.jpg', '好好学习，天天向上');
var s10 = new Student(10, '陈用群', '温州', '学生会', 'img/pic/10.jpg', '好好学习，天天向上');

var yd1701 = [s1, s2, s3, s4, s5, s6, s7, s8, s7, s10];

function fun_member() {
	for(var i; i < 3; i++) {
		var r = Math.floor((Math.random() * 10));
		var img = yd1701[r].img;
		var motto = yd1701[r].motto
		var intro = yd1701[r].title + ':' + yd1701[r] +
		'，' + yd1701[r].hometown;
		div.eq(i).find('img').attr("scr", img);
		p.eq(i).text(motto);
		p.eq(i).siblings('h4').text(intro);
	}
}